package com.daydayup.test20190429;

/**
 * 栈
 * 
 * @author Lee
 *
 */
public class Stack {

	private Node node;

	public void push(Object value) {
		Node currentNode = new Node();
		currentNode.setValue(value);
		currentNode.setBeforeNode(node);
		node = currentNode;
	}

	public Object pop() {
		if (node == null) {
			throw new StackException("栈空了，弹栈异常");
		}
		Object value = node.getValue();
		node = node.getBeforeNode();
		return value;
	}

}
